package com.java.tutorials.jdk7.files;
import com.java.tutorials.Constants;

import java.nio.file.FileStore;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.AclFileAttributeView;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.DosFileAttributeView;
import java.nio.file.attribute.FileAttributeView;
import java.nio.file.attribute.FileOwnerAttributeView;
import java.nio.file.attribute.PosixFileAttributeView;
import java.nio.file.attribute.UserDefinedFileAttributeView;
/**
 * Created by xuzhike on 2016/1/26.
 * http://www.java2s.com/Code/Java/JDK-7/Checkforthesupportedattribute.htm
 * Check for the supported attribute
 */
public class Checkforthesupportedattribute {
    public static void main(String[] args) throws Exception {
        Path path = Paths.get(Constants.TEST_FILE_WITH_PATH);
        FileStore fileStore = Files.getFileStore(path);
        System.out.println("FileAttributeView supported: "
                + fileStore.supportsFileAttributeView(FileAttributeView.class));
        System.out.println("BasicFileAttributeView supported: "
                + fileStore.supportsFileAttributeView(BasicFileAttributeView.class));
        System.out.println("FileOwnerAttributeView supported: "
                + fileStore.supportsFileAttributeView(FileOwnerAttributeView.class));
        System.out.println("AclFileAttributeView supported: "
                + fileStore.supportsFileAttributeView(AclFileAttributeView.class));
        System.out.println("PosixFileAttributeView supported: "
                + fileStore.supportsFileAttributeView(PosixFileAttributeView.class));
        System.out.println("UserDefinedFileAttributeView supported: "
                + fileStore
                .supportsFileAttributeView(UserDefinedFileAttributeView.class));
        System.out.println("DosFileAttributeView supported: "
                + fileStore.supportsFileAttributeView(DosFileAttributeView.class));

        System.out.println("FileAttributeView supported: "
                + fileStore.supportsFileAttributeView("file"));
        System.out.println("BasicFileAttributeView supported: "
                + fileStore.supportsFileAttributeView("basic"));
        System.out.println("FileOwnerAttributeView supported: "
                + fileStore.supportsFileAttributeView("owner"));
        System.out.println("AclFileAttributeView supported: "
                + fileStore.supportsFileAttributeView("acl"));
        System.out.println("PosixFileAttributeView supported: "
                + fileStore.supportsFileAttributeView("posix"));
        System.out.println("UserDefinedFileAttributeView supported: "
                + fileStore.supportsFileAttributeView("user"));
        System.out.println("DosFileAttributeView supported: "
                + fileStore.supportsFileAttributeView("dos"));
    }
}
